<#include "../inc/view.html"/>
<@view>
            <div class="row">
                <div class="col-sm-12">
                    <div class="row">
                        <div class="col-sm-6">
                            <ol class="breadcrumb">
                                <li>
                                    <b>系统</b>
                                </li>
                                <li class="active">
                                    相册类别
                                </li>
                            </ol>
                        </div>
                        <div class="col-sm-6">
                            <button class="btn-sm btn-success pull-right" onclick="contentLoadPage('/albumCate/add')"><i class="fa fa-plus"></i>新增</button>
                        </div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-sm-12">
                        <table class="table table-bordered m-0">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>中文名称</th>
                                <th>英文名称</th>
                                <th>编码</th>
                                <th>排序</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#if dataList??>
                                <#list dataList as m>
                                    <#if (''==(m.parentid)!'') && m.levelno==1>
                                        <tr>
                                            <td>${m.id!}</td>
                                            <td>${m.name!}</td>
                                            <td>${m.en_name!}</td>
                                            <td>${m.code!}</td>
                                            <td>${m.sort!}</td>
                                            <td><#if 1==m.status!0 ><span class="green">启用</span><#else><span class="red">禁用</span></#if></td>
                                            <td>
                                                <a href="javascript:void(0);" onclick="contentLoadPage('/albumCate/add/-${m.id}-2')"><i class="fa fa-plus"></i>添加子分类</a>
                                                <a href="javascript:void(0);" onclick="contentLoadPage('/albumCate/add/${m.id}')"><i class="fa fa-edit"></i>编辑</a>
                                                <a href="javascript:void(0);" onclick="delMenu('${m.id}')"><i class="fa red fa-trash"></i>删除</a>
                                            </td>
                                        </tr>
                                        <#list dataList as mc>
                                            <#if m.id==(mc.parentid)!>
                                                <tr>
                                                    <td>${mc.id!}</td>
                                                    <td style="padding-left:50px;">${mc.name!}</td>
                                                    <td>${mc.en_name!}</td>
                                                    <td>${mc.code!}</td>
                                                    <td>${mc.sort!}</td>
                                                    <td><#if 1==mc.status!0 ><span class="green">启用</span><#else><span class="red">禁用</span></#if></td>
                                                    <td>
                                                        <a href="javascript:void(0);" onclick="contentLoadPage('/albumCate/add/-${mc.id}-3')"><i class="fa fa-plus"></i>添加子分类</a>
                                                        <a href="javascript:void(0);" onclick="contentLoadPage('/albumCate/add/${mc.id}')"><i class="fa fa-edit"></i>编辑</a>
                                                        <a href="javascript:void(0);" onclick="delMenu('${mc.id}')"><i class="fa red fa-trash"></i>删除</a>
                                                    </td>
                                                </tr>
                                                <#list dataList as mb>
                                                    <#if mc.id==(mb.parentid)!>
                                                        <tr>
                                                            <td>${mb.id}</td>
                                                            <td style="padding-left:100px">${mb.name}</td>
                                                            <td>${mb.en_name!}</td>
                                                            <td>${mb.code!}</td>
                                                            <td>${mb.sort!}</td>
                                                            <td><#if 1==mb.status!0 ><span class="green">启用</span><#else><span class="red">禁用</span></#if></td>
                                                            <td>
                                                                <a href="javascript:void(0);" onclick="contentLoadPage('/albumCate/add/${mb.id}')"><i class="fa fa-edit"></i>编辑</a>
                                                                <a href="javascript:void(0);" onclick="delMenu('${mb.id}')"><i class="fa red fa-trash"></i>删除</a>
                                                            </td>
                                                        </tr>
                                                        </#if>
                                                    </#list>
                                            </#if>
                                        </#list>
                                    </#if>
                                </#list>
                            </#if>
                            </tbody>
                        </table>
                        </div>
                    </div>
                </div>
            </div>
</@view>
<script>
    function delMenu(id_){
        layer.confirm('确定要删除此分类吗？', {
            btn: ['删除','取消'],shadeClose:true
        },function() {
            $.ajax({
                url: '/admin/albumCate/del/' + id_, success: function (json) {
                    if (json.code == RESULT_SUCCESS) {
                        contentLoadPage('/albumCate');
                        layer.closeAll();
                    } else {
                        if (json.msg)
                            layer.alert(json.msg, {icon: 5, title: '系统提示',time:3000,shadeClose:true});
                    }
                }
            });
        },function(){
        });
    }
</script>